package com.gxa.educate.core.exception;

/**
 * 声明一个描述异常类型和消息的枚举
 * 当代码托管之后(gitee), 专人负责修改该代码
 */
public enum ExceptionCode {

    /**
     * 枚举要先把对象声明好,
     * 访问的时候,只能访问这些提前声明的对象
     *
     * 在枚举出现之前(1.5之前),要达到相同的效果得通过静态常量
     * public static final String SERVER_FAILED = "50001";
     * code 是企业自己的规定
     * 后续再需要自定义异常信息的时候,再添加
     * 枚举值用全大写(java规定),且是英文(企业规定)
     * 多个枚举值之间用逗号隔开
     * 枚举值把所有的备选项都先设计好, 使用时只能从它们中间获取
     *
     */
    SERVER_FAILED("50000", "服务器开小差了,请稍后再试"),
    LOGIN_FAILED("50001", "登录失败,请检查用户名或密码是否正确"),
    DUPLICATE_USERNAME("50002","重复的用户名"),
    DELETE_USER_FAILED("50003","删除失败"),
    UPDATE_USER_FAILED("50004","修改失败"),
    SEND_SMS_FAILED("50005","发送失败"),
    WRONG_PHONE_NUMBER("50006","手机号格式不正确"),
    DUPLICATE_PHONE("50007","该手机号已注册"),
    WORNG_PHONE_FAILED("50008","没有找到该用户"),
    WORNG_TOKEN_FAILED("50009","没有权限"),
    NULL_TOKEN_FAILED("50010","token为空"),
    NULL_PHONE("50011","手机号为空"),
    CODE_EXPIRE("50012","验证码已失效"),
    WRAN_CODE("50013","验证码不正确"),
    WRAN_USER_LOGIN("50013","账号已冻结"),
    TOKEN_FAILED("50014","token验证不通过"),
    TOKEN_EXPIRE("50015","token已过期"),
    STATIC_ERROR("50016","状态异常"),
    NULL_GOOD("50017","没有该商品的ID"),
    ;

    private String code;
    private String message;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    ExceptionCode(String code, String message) {
        this.code = code;
        this.message = message;
    }
}
